#!/bin/bash

find sources -iname "*.java" > .list.tmp
svn update && javadoc -link http://ochafik.free.fr/Java/javadoc/jmdns/ -link http://java.sun.com/javase/6/docs/api/ -d javadoc/ -classpath sources/:/Users/ochafik/Prog/Java/libraries/jmdns.jar @.list.tmp

find javadoc/ -iname "*.html" -exec svn add '{}' ';' 2> /dev/null
	
# See http://stuffthathappens.com/blog/2007/11/09/howto-publish-javadoc-on-google-code/
if [[ ! -z "$RETAG" ]] ; then
	find javadoc/ -iname "*.html" -exec svn propset svn:mime-type text/html '{}' ';'
	find javadoc/ -iname "*.css" -exec svn propset svn:mime-type text/css '{}' ';'
	find javadoc/ -iname "*.txt" -exec svn propset svn:mime-type text/plain '{}' ';'
	find javadoc/ -iname "*.png" -exec svn propset svn:mime-type image/png '{}' ';'
	find javadoc/ -iname "*.jpg" -exec svn propset svn:mime-type image/jpeg '{}' ';'
	find javadoc/ -iname "*.jpeg" -exec svn propset svn:mime-type image/jpeg '{}' ';' ;
fi

if [[ ! -z "$COMMIT" ]] ; then
	svn commit javadoc -m "Javadoc update" ;
fi

rm -f .list.tmp
